<?php echo $header; ?>
<div id="content">
    <div class="breadcrumb">
        <?php echo $this->breadCrumbs(); ?>
    </div>
    <?php if (isset($error_warning)) { ?>
    <div class="warning"><?php echo $error_warning; ?></div>
    <?php } ?>
    <?php if ($success) { ?>
    <div class="success"><?php echo $success; ?></div>
    <?php } ?>
    <div class="box">
        <div class="heading">
            <h1><img src="view/image/payment.png" alt="" /> <?php echo $_['heading_title']; ?></h1>
            <div class="buttons">
                <a onclick="$('#form').submit();" class="button"><?php echo $_['button_save']; ?></a>
                <a href="<?php echo UA('sale/couponcard'); ?>" class="button"><?php echo $_['button_cancel']; ?></a></div>
        </div>

       <div class="content">
        <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form">
         <table class="list">
            <div id="tab-general">
               
                  <thead>
                      <tr>
                         <td width="1" style="text-align: center;"><input type="checkbox" onclick="$('input[name*=\'selected\']').attr('checked', this.checked);" /></td>
                         <td width="750" class="center" >
                            <a #><?php echo $_['couponcard_range'] ; ?></a>
                         </td>
                         <td class="center">
                              <a #><?php echo $_['couponcard_reward']; ?></a>
                         </td>
                      </tr>
                   </thead>

                    <tbody>
                  
                    <?php if(!empty($couponcards)){ foreach ($couponcards as $couponcard) { ?>
                    <tr>
                        <td style="text-align: center;">
                            <input type="checkbox" name="selected[]" value="<?php echo $couponcard['couponID']; ?>" />
                        </td>
                        <td class="center"><?php echo $couponcard['lowAmount']; ?>&nbsp;&nbsp;&nbsp;&nbsp;~&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $couponcard['highAmount']; ?></td>
                        <td class="center"><?php echo $couponcard['reward']?></td>
                    </tr>

                    <?php } }?>
                  
                   
                     <tr>
                      <td style="text-align: center;">
                        <input type="checkbox" name="selected[]" value="<?php echo $couponcard['couponID']; ?>" />
                      </td>
                      <td class="center"><input name='lowAmount' value="<?php echo $lowAmount; ?>">&nbsp;&nbsp;&nbsp;&nbsp;~&nbsp;&nbsp;&nbsp;&nbsp;
                      <input name='highAmount' value="<?php echo $highAmount; ?>">
                      <?php if (isset($error_entry)) { ?>
                            <span class="error"><?php echo $error_entry; ?></span>
                            <?php } ?></td>
                      <td class="center"><input name='reward' value="<?php echo $reward; ?>"></td>  

                    </tr>


                    </tbody>

                </table>
            </div>
        </form>
          
        </div>
    </div>
</div>


<script type="text/javascript"><!--
    function sendCouponcard(couponID) {
        $.ajax({
            url: '<?php echo UA('sale/couponccard/update'); ?>&couponID=' + couponID;
                type: 'post',
                dataType: 'json',
                beforeSend: function() {
            $('.success, .warning').remove();
            $('.box').before('<div class="attention"><img src="view/image/loading.gif" alt="" /> <?php echo $_['text_wait']; ?></div>');
        },
        complete: function() {
            $('.attention').remove();
        },
        success: function(json) {
            if (json['error']) {
                $('.box').before('<div class="warning">' + json['error'] + '</div>');
            }

            if (json['success']) {
                $('.box').before('<div class="success">' + json['success'] + '</div>');
            }
        }
    });
    }
    //--></script>
<?php echo $footer; ?>